package com.caine.object;

import org.openjdk.jol.info.ClassLayout;


/**
 * -XX:+/-UseCompressedOops 字节压缩,压缩kclass指针
 * 对象组成
 * 对象头+实例数据+填充
 *
 * markword:8
 * kclass pointer:4
 * data:4
 * padding:0
 *
 * OFFSET  SIZE   TYPE DESCRIPTION                               VALUE
 *       0     4        (object header)                           01 64 e4 40 (00000001 01100100 11100100 01000000) (1088709633)
 *       4     4        (object header)                           74 00 00 00 (01110100 00000000 00000000 00000000) (116)
 *       8     4        (object header)                           05 c1 00 f8 (00000101 11000001 00000000 11111000) (-134168315)
 *      12     4    int ObjectApplication.a                       0
 */
public class ObjectApplication {
    int a = 0;
    public static void main(String[] args) {
        ObjectApplication obj = new ObjectApplication();
        obj.hashCode();
        System.out.println(ClassLayout.parseInstance(obj).toPrintable());
    }

}
